package com.example.knowledgeget1.FileOperate;
import com.example.knowledgeget1.Common.ResponseResult;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/pdf")
public class PdfController {
    private final PdfService pdfService;
    @Autowired
    public PdfController(PdfService pdfService) {
        this.pdfService = pdfService;
    }
    @PostMapping("/resolve")
    public ResponseResult resolvePdf(@RequestParam("file") MultipartFile file) {
        try {
            return ResponseResult.success(pdfService.resolvePdf(file));
        } catch (IOException e) {
            e.printStackTrace();
            return ResponseResult.fail();
        }
    }
}
